<template>
  <div class="content-remove-form">
    <el-form :model="formStore">
      <el-form-item label="删除样式">
        <el-select v-model="formStore.contentRemoveStyle">
          <el-option label="所有英文字母" value="0" />
          <el-option label="所有中文字母" value="1" />
          <el-option label="所有数字" value="2" />
          <el-option label="所有特殊字符" value="3" />
          <el-option label="删除指定字符" value="4" />
        </el-select>
      </el-form-item>
      <template v-if="formStore.contentRemoveStyle === '4'">
        <el-form-item label="删除方式">
          <el-radio-group v-model="formStore.contentRemoveMethod">
            <el-radio value="0">指定内容</el-radio>
            <el-radio value="1">指定位置</el-radio>
          </el-radio-group>
        </el-form-item>
        <template v-if="formStore.contentRemoveMethod === '0'">
          <el-form-item label="删除内容" label-position="top">
            <el-input
              v-model="formStore.contentRemoveText"
              :rows="3"
              type="textarea"
              placeholder="请输入删除内容"
            />
          </el-form-item>
        </template>
        <template v-else>
          <el-form-item>
            <div class="line" style="margin-bottom: 18px">
              <span>从</span>
              <el-select
                v-model="formStore.fileNamePosition"
                style="width: 115px; margin: 0 8px"
              >
                <el-option label="文件名前" value="0" />
                <el-option label="文件名后" value="1" />
              </el-select>
              <span>第</span>
              <el-input-number
                :min="0"
                :max="99"
                v-model="formStore.charAtPositionN"
                controls-position="right"
                style="width: 90px; margin: 0 8px"
              />
              <span>个字符</span>
            </div>
            <div class="line">
              <span style="color: #e74c3c">向{{ positionText }}删除</span
              >，共删除
              <el-input-number
                v-model="formStore.removeCharCount"
                :min="0"
                :max="99"
                controls-position="right"
                style="width: 90px; margin: 0 6px"
              />
              <span>个字符</span>
            </div>
          </el-form-item>
        </template>
      </template>
    </el-form>
  </div>
</template>

<script lang="ts" setup>
import useContentRemoveFormStore from '@renderer/store/Form/ContentRemoveFormStore'
import { computed } from 'vue'

const formStore = useContentRemoveFormStore()

const positionText = computed(() => {
  return formStore.fileNamePosition === '0' ? '右' : '左'
})
</script>

<style lang="less" scoped>
.content-remove-form {
  .content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }
}
</style>
